<?php


/**
* Puree CMS
* http://www.molotsoft.ru
*
* @package Puree_CMS
* @subpackage Controllers
* @author Ivan Chistyakov <ivan@molotsoft.ru>
* @version $Id: accounts_controller.php 868 2010-03-15 12:00:58Z molotsoft@gmail.com $
* @link $HeadURL: http://puree-cms.googlecode.com/svn/trunk/controllers/accounts_controller.php $
*/


class AccountsController extends GeneralController {

/******************************************************************************/

var $name = 'Accounts';

var $components = array('Auth', 'Cart');

/******************************************************************************/

function beforeFilter() {
	parent::beforeFilter();
	// auth
	if (!(bool)Configure::read('admin')) {
		$this->Auth->userModel = 'Account';
		$this->Auth->userScope = array('Account.activated' => TRUE);
		$this->Auth->fields = array('username' => 'email', 'password' => 'password');
		$this->Auth->authError = __('account_auth_error_message', TRUE);
		$this->Auth->loginError = __('account_login_error_message', TRUE);
		$this->Auth->loginRedirect = array('controller' => 'accounts', 'action' => 'welcome');
		$this->Auth->deny('welcome', 'profile', 'logout', 'checkout');
	}
}

/******************************************************************************/

function newaccount() {
	// empty
}

function forgotpassword() {
	// empty
}

/******************************************************************************/

function login() {
	// empty
}

function welcome() {
	// nothing to do
}

function profile() {
	// empty
}

function logout() {
	$this->redirect($this->Auth->logout());
}

/******************************************************************************/

function cart() {
	$this->redirect(array('controller' => 'items', 'action' => 'cart'));
}



function checkout() {
	$this->loadModel('Item');
	//$this->set('cart_info', $cart_info = $this->Cart->getInfo());	
	$this->set('rows', $rows = $this->Item->find('all', array('conditions' => array('Item.id' => $this->Cart->getIds()))));
	if ($this->RequestHandler->isPost()) {

	}
}

function thanks() {
	// nothing to do
}

/******************************************************************************/

}


?>